<style>
    .form-group label {
        width: 105px
    }
</style>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-danger">
                <div class="box-body">
                    <form id="member_group_editinfo_form">
                        <input type="hidden" name="id" value="{$info.id}"/>
                        <div class="form-group">
                            <label style="display:inline-table">类型名称
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入类型名称"
                                   class="form-control" data-validation="required"
                                   name="name" value="{$info.name}"
                                   data-validation-error-msg="请输入类型名称"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table;float: left">会员卡图片
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <div style="width: 110px;float: left;">
                                <img id="content_add_news_form_thumb" src="{$info.thumb}"
                                     src="" alt="上传图片"
                                     style="width:100px;height:100px;display:block;border:1px solid #ddd;padding:2px;<if condition='empty($info[thumb])'>display:none;</if>"/>
                                <input type="hidden" name="thumb" id="thumb" value="{$info.thumb}"/>
                                <input id="form_up_file" type="file" tabindex="-1" name="filedata" size="13"
                                       style="width: 1px;height: 1px">
                                <button class="btn btn-info pull-left" type="button"
                                        onclick="return  thumbUpload('form_up_file');">点击上传缩略图
                                </button>
                            </div>
                        </div>
                        <div style="clear: both; margin-bottom: 10px"></div>
                        <div class="form-group">
                            <label style="display:inline-table">说明
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入类型名称"
                                   class="form-control"
                                   name="note" value="{$info.note}"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">套餐类型
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <foreach name="types" item="type" key="k">
                                <lable>
                                    <input class="minimal" type="radio" value="{$k}" name="type"
                                         <if condition="(empty($info) and $k eq 0) or $k eq $info[type]">checked="checked"</if>
                                              onclick="changeMode(this)"/> {$type}
                                </lable>
                                &nbsp;
                            </foreach>
                        </div>
                        <div class="form-group" >
                            <label style="display:inline-table">充值金额
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入充值金额"
                                   class="form-control"
                                   data-validation="required"
                                   name="price" value="{$info.price}"
                                   data-validation-error-msg="请输入充值金额"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="group0 selectgroup" <if condition="!empty($info) and $info[type] neq 0"> style="display: none"</if>>
                            <div class="form-group">
                                <label style="display:inline-table">每年可洗
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入年可洗件数"
                                       class="form-control"
                                       name="laundry_count0" value="{$info.laundry_count}"
                                       style="display:inline;width: 60%">件

                            </div>
                            <div class="form-group">
                            <label style="display:inline-table">商城可消费金额
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入商城可消费金额"
                                   class="form-control"
                                   name="shopping0" value="{$info.shopping}"
                                   style="display:inline;width: 70%">
                            </div>
                        </div>
                        <div class="group1 selectgroup"  <if condition="empty($info) or $info[type] neq 1"> style="display: none"</if>>
                            <div class="form-group">
                                <label style="display:inline-table">赠送金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入赠送金额"
                                       class="form-control"
                                       name="give_price1" value="{$info.give_price}"
                                       style="display:inline;width: 70%">
                            </div>
                            <div class="form-group">
                                <label style="display:inline-table">奢侈品护理金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入奢侈品护理金额"
                                       class="form-control"
                                       name="luxury1" value="{$info.luxury}"
                                       style="display:inline;width: 70%">
                            </div>
                            <div class="form-group">
                                <label style="display:inline-table">商城可消费金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入商城可消费金额"
                                       class="form-control"
                                       name="shopping1" value="{$info.shopping}"
                                       style="display:inline;width: 70%">
                            </div>
                        </div>
                        <div class="group2 selectgroup"  <if condition="empty($info) or $info[type] neq 2"> style="display: none"</if>>
                            <div class="form-group">
                                <label style="display:inline-table">每年可洗
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入年可洗件数"
                                       class="form-control"
                                       name="laundry_count2" value="{$info.laundry_count}"
                                       style="display:inline;width: 60%">
                                件
                            </div>
                            <div class="form-group">
                                <label style="display:inline-table">赠送金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入赠送金额"
                                       class="form-control"
                                       name="give_price2" value="{$info.give_price}"
                                       style="display:inline;width: 70%">
                            </div>
                            <div class="form-group">
                                <label style="display:inline-table">奢侈品护理金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入奢侈品护理金额"
                                       class="form-control"
                                       name="luxury2" value="{$info.luxury}"
                                       style="display:inline;width: 70%">
                            </div>
                            <div class="form-group">
                                <label style="display:inline-table">商城可消费金额
                                    <i class="fa fa-pencil-square-o"></i>:</label>
                                <input type="text" placeholder="请输入商城可消费金额"
                                       class="form-control"
                                       name="shopping2" value="{$info.shopping}"
                                       style="display:inline;width: 70%">
                            </div>
                        </div>
                        <div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-danger pull-left" type="button" id="close-dialog">取消</button>
                                <button class="btn btn-primary pull-right" type="button"
                                        id='member_group_editinfo_form_submit'>提交
                                </button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
                checkboxClass: 'icheckbox_minimal-blue',
                radioClass: 'iradio_minimal-blue'
            });
            $('input[type="radio"].minimal').each(function (index) {
                $(this).on('ifChecked', function (event) {
                    $('.selectgroup').hide();
                    $('.selectgroup').eq(index).show();
                });

            });

            $('#member_group_editinfo_form_submit').click(function () {
                $('#member_group_editinfo_form').submit();
            });
            $.validate({
                onSuccess: function () {
                    publicEditinfoFormSubmit();
                    return false;
                }
            });
            var action = "{:U('Upload/thumb', array('width'=>200, 'height'=>100))}";
            fileupload(action, $("#form_up_file"), $("#thumb"), $("#content_add_news_form_thumb"));
        });

        function publicEditinfoFormSubmit() {
            $.post("{:U('Member/addGroup')}",
                    $("#member_group_editinfo_form").serialize(), function (res) {
                        if (!res.status) {
                            $.messager.alert('提示信息', res.info, 'error');
                        } else {
                            $.messager.alert('提示信息', res.info, 'info');
                            dialog.get('dialogPage').close().remove();
                            reloadContent();
                        }
                    });

            return false;
        }
    </script>
</section>